<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>


    <![endif]-->
</head>

<body>
<div class="x-body layui-anim layui-anim-up">
    <form class="layui-form" action="upuserServlet?idd=1" method="post"  >
        <div class="layui-form-item">
            <label for="L_uname" class="layui-form-label">
                <span class="x-red">*</span>编号
            </label>
            <div class="layui-input-inline">
                <input type="text" id="uid" name="uid" required="" lay-verify="uid"
                       autocomplete="off" class="layui-input" value="${u.uid}" readonly="readonly">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_uname" class="layui-form-label">
                <span class="x-red">*</span>姓名
            </label>
            <div class="layui-input-inline">
                <input type="text" id="L_uname" name="uname" required="" lay-verify="uname"
                       autocomplete="off" class="layui-input" value="${u.uname}">
            </div>
            <div class="layui-form-mid layui-word-aux" id="i"></div>
        </div>
        <div class="layui-form-item">
            <label for="L_uphone" class="layui-form-label">
                <span class="x-red">*</span>手机号
            </label>
            <div class="layui-input-inline">
                <input type="text" id="L_uphone" name="uphone" required="" lay-verify="uphone"
                       autocomplete="off" class="layui-input" value="${u.uphone}">
            </div>
            <div class="layui-form-mid layui-word-aux" id="ii"></div>
        </div>
        <div class="layui-form-item">
            <label for="L_upasswrod" class="layui-form-label">
                <span class="x-red">*</span>密码
            </label>
            <div class="layui-input-inline">
                <input type="password" id="L_upasswrod" name="upasswrod" required="" lay-verify="upasswrod"
                       autocomplete="off" class="layui-input" value="${u.upasswrod}">
            </div>
            <div class="layui-form-mid layui-word-aux" id="iii"></div>
        </div>
        <div class="layui-form-item">
            <label for="L_upasswrod" class="layui-form-label">
                <span class="x-red">*</span>确认密码
            </label>
            <div class="layui-input-inline">
                <input type="password" id="L_upasswrodd" name="upasswrodd" required="" lay-verify="upasswrod"
                       autocomplete="off" class="layui-input" value="${u.upasswrod}">
            </div>
            <div class="layui-form-mid layui-word-aux" id="iiiiii">

            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-form-item" id="x-city">
                <label class="layui-form-label">省，市，县/区</label>
                <div class="layui-input-inline">
                    <select name="province" lay-filter="province" >
                        <c:forEach items="${u.areaName}" var="a">
                            <option value="${a.areaName}" selected="selected">${a.areaName}</option>
                        </c:forEach>
                        <option value="">请选择省</option>
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="city" lay-filter="city">
                        <c:forEach items="${u.areaName1}" var="a">
                            <option value="${a.areaName}" selected="selected">${a.areaName}</option>
                        </c:forEach>
                        <option value="">请选择市</option>
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="area" lay-filter="area">
                        <c:forEach items="${u.areaName2}" var="a">
                            <option value="${a.areaName}" selected="selected">${a.areaName}</option>
                        </c:forEach>
                        <option value="">请选择县/区</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-mid layui-word-aux" id="iiii"></div>
        </div>
        <div class="layui-form-item">
            <label for="L_uaddress" class="layui-form-label">
                <span class="x-red">*</span>用户地址
            </label>
            <div class="layui-input-inline">
                <input type="text" id="L_uaddress" name="uaddress" required="" lay-verify="uaddress"
                       autocomplete="off" class="layui-input" value="${u.uaddress}">
            </div>
            <div class="layui-form-mid layui-word-aux" id="iiiii"></div>
        </div>
        <div class="layui-form-item">
            <label for="L_usex" class="layui-form-label">
                <span class="x-red">*</span>性别
            </label>
            <c:if test="${u.usex=='男'}">
                男<input type="radio" name="usex"checked="checked" value="男">
                女<input type="radio" name="usex"value="女">
            </c:if>
            <c:if test="${u.usex=='女'}">
                男<input type="radio" name="usex" value="男">
                女<input type="radio" name="usex" checked="checked" value="女">
            </c:if>
        </div>
        <div class="layui-form-item">
            <label for="L_createTime" class="layui-form-label">
                <span class="x-red">*</span>创建时间
            </label>
            <div class="layui-input-inline">
                <input type="datetime" id="L_createTime" name="createTime" required="" lay-verify="createTime"
                       autocomplete="off" class="layui-input" value="${u.createTime}">
            </div>
            <div class="layui-form-mid layui-word-aux" id="iiiiiii"></div>
        </div>
        <div class="layui-form-item">
            <label for="L_openid" class="layui-form-label">
                <span class="x-red">*</span>微信openid
            </label>
            <div class="layui-input-inline">
                <input type="text" id="L_openid" name="openid" required="" lay-verify="openid"
                       autocomplete="off" class="layui-input" value="${u.openid}">
            </div>
            <div class="layui-form-mid layui-word-aux" id="iiiiiiii"></div>
        </div>
        <div class="layui-form-item">
            <label for="L_check" class="layui-form-label">
                <span class="x-red">*</span>审核状态
            </label>
            <c:if test="${u.check==0}">
                未审核<input type="radio" name="check" value="0" checked="checked">
                审核通过<input type="radio"  name="check"value="1" >
            </c:if>
            <c:if test="${u.check==1}">
                未审核<input type="radio" name="check" value="0" >
                审核通过<input type="radio"  name="check" value="1" checked="checked" >
            </c:if>
        </div>
        <div class="layui-form-item">
            <label for="L_uemail" class="layui-form-label">
                <span class="x-red">*</span>邮箱地址
            </label>
            <div class="layui-input-inline">
                <input type="text" id="L_uemail" name="uemail" required="" lay-verify="uemail"
                       autocomplete="off" class="layui-input" value="${u.uemail}">
            </div>
            <div class="layui-form-mid layui-word-aux" id="iiiiiiiiiii"></div>
        </div>
        <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">
            </label>
            <button  class="layui-btn" lay-filter="add" lay-submit="">
                修改
            </button>
        </div>
    </form>
</div>

<script src="js/jquery-1.12.4.min.js"></script>
<script>
    $(function () {
        var boo=true;
        $("[name=uname]").focus()
        $("[name=uname]").change(function () {
            var name=$("[name=uname]").val();
            if (name!=""){
                $.post("finduserByNameServlet",{"uname":name},function (data) {
                    if(data>0){
                        $("#i").text("有重复名字")
                    }else{
                        $("#i").text("")
                    }
                })
            }else{
                $("#i").text("名字不能为空")
            }
        })
        $("[name=uphone]").blur(function () {;
            var salephone=$(this).val();
            var phone=/^\d{11}$/;
            if (salephone==""){
                $("#ii").text("手机号不能为空")
            }else if(phone.test(salephone)==false){
                $("#ii").text("手机号要为11位数字")
            }else {
                $("#ii").text("")
            }
        })
        $("[name=uaddress]").blur(function () {
            var address=$(this).val();
            if (address==""){
                $("#iiiii").text("地址不能为空")
            }else {
                $("#iiiii").text("")
            }
        })
        $("[name=upasswrod]").blur(function () {
            var upasswrod=$(this).val();
            if (upasswrod==""){
                $("#iii").text("密码不能为空")
            }else {
                $("#iii").text("")
            }
        })
        $("[name=upasswrodd]").blur(function () {
            var upasswrodd=$(this).val();
            var upasswrod=$("[name=upasswrod]").val();
            if (upasswrodd==""){
                $("#iiiiii").text("密码不能为空")
            }else if(upasswrod!=upasswrodd){
                $("#iiiiii").text("两次密码不一致")
            } else {
                $("#iiiiii").text("")
            }
        })
        $("[name=createTime]").blur(function () {
            var createTime=$(this).val();
            var time=/^\d{4}\-\d{2}\-\d{2}$/
            if (createTime==""){
                $("#iiiiiii").text("创建时间不能为空")
            } else if(time.test(createTime)==false){
                $("#iiiiiii").text("时间格式不正确")
            } else {
                $("#iiiiiii").text("")
            }
        })
        $("[name=uemail]").blur(function () {
            var uemail=$(this).val();
            var email = /^\w{2,}\@\w{2,}(.com)|(.cn)$/;
            if (email.test(uemail)==false&&uemail!=""){
                $("#iiiiiiiiiii").text("邮箱地址不正确")
            }else {
                $("#iiiiiiiiiii").text("")
            }
        })
        $("button").click(function () {
            boo=true;
            var iiiiiiiiiii=$("#iiiiiiiiiii").text();
            var iiiiiii=$("#iiiiiii").text();
            var iii=  $("#iii").text();
            var iiiii= $("#iiiii").text();
            var iiiiii= $("#iiiiii").text();
            var ii=$("#ii").text();
            var i=$("#i").text();
            if (iiiiiiiiiii!=""){
                boo=false
            }
            if (iiiiiii!=""){
                boo=false
            }
            if (iii!=""){
                boo=false
            }
            if (iiiiii!=""){
                boo=false
            }
            if (iiiii!=""){
                boo=false
            }
            if (ii!=""){
                boo=false
            }
            if (i!=""){
                boo=false
            }
            if (boo==true){
                alert("修改成功");
            }else{
                alert("修改失败")
            }
            return boo;
        })
    });
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;

        //自定义验证规则
        form.verify({
            nikename: function(value){
                if(value.length < 5){
                    return '昵称至少得5个字符啊';
                }
            }
            ,pass: [/(.+){6,12}$/, '密码必须6到12位']
            ,repass: function(value){
                if($('#L_pass').val()!=$('#L_repass').val()){
                    return '两次密码不一致';
                }
            }
        });

        //监听提交



    });
</script>
<script type="text/javascript" src="./js/xcity.js"></script>
<script>
    layui.use(['form','code'], function(){
        form = layui.form;
        layui.code();
        //初始化
        var namee=$("[name=uid]").val();
        $.post("finduserByuidscqServlet",{"id":namee},function (data) {
            $(data).each(function () {
                $('#x-city').xcity(this.areaName[0].areaName,this.areaName1[0].areaName,this.areaName2[0].areaName);
            })
        },"json");
    });
</script>
<script>var _hmt = _hmt || []; (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();</script>
<script>var _hmt = _hmt || []; (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();</script>
</body>

</html>